package cate.game.role.mail.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBMail;
import cate.game.role.mail.RoleMail;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

import java.util.List;

@ClientMsg(title = "邮件删除 の 请求")
public class MailDeleteReq implements MsgInput {
    @NoteField(value = "需要删除的邮件的uid们", detail = "可以为NULL")
    public List<String> uidList;

    @NoteField(value = "已读的都删除", detail = "可以为NULL")
    public boolean deleteRead;

    @NoteField(value = "已领取的都删除", detail = "可以为NULL")
    public boolean deleteGot;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        RoleMail roleMail = cc.getRole().getMail();
        EcResult<List<String>> r = roleMail.delete(uidList,deleteRead,deleteGot);
        MailDeleteResp resp = new MailDeleteResp();
        resp.deletedIdHexList = r.data;
        cc.sendNow(resp);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBMail.MAIL_DELETE_REQ;
    }
}
